
package com.liao.badminton.controller;

import com.liao.badminton.code.*;
import com.liao.badminton.dto.ActivityParticipatorDto;
import com.liao.badminton.vo.ActivityParticipatorVo;
import com.github.pagehelper.PageInfo;
import com.liao.badminton.service.ActivityParticipatorService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import com.liao.badminton.code.validation.Delete;
import com.liao.badminton.code.validation.Insert;
import com.liao.badminton.code.validation.Update;
import com.liao.badminton.code.validation.FindDetail;
import org.springframework.validation.annotation.Validated;

import java.util.List;

/**
* @author liaocheng
* @date 2024-11-15
* description:活动参与者表
*/
@RestController
@RequestMapping(value = "/activityParticipator")
//@PreAuthorize("@ss.hasPermission('activityParticipator')")//权限管理;
public class ActivityParticipatorController {

  //  private static  Logger logger= LoggerFactory.getLogger(ActivityParticipatorController.class);

    @Autowired
    private ActivityParticipatorService activityParticipatorService;




    /**
    * 新增activityParticipator
    */
    @RequestMapping(value = "/add")
    @PreAuthorize("@ss.hasPermission('activityParticipator:add')")//权限管理;
    public ResponseRest<Long> add(@RequestBody @Validated(Insert.class) ActivityParticipatorDto activityParticipator)throws ProjectException{
        return activityParticipatorService.saveActivityParticipator(activityParticipator);
    }
    /**
    * 批量删除
    */
    @RequestMapping(value = "/deletes")
    @PreAuthorize("@ss.hasPermission('activityParticipator:deletes')")//权限管理;
    public ResponseRest<Boolean> deletes(@RequestBody @Validated(Delete.class) ActivityParticipatorDto param)throws ProjectException{
        return activityParticipatorService.deletesActivityParticipator(param);
    }
    /**
    * 修改activityParticipator
    */
    @RequestMapping(value = "/update")
    @PreAuthorize("@ss.hasPermission('activityParticipator:update')")//权限管理;
    public ResponseRest<Boolean> update(@RequestBody @Validated(Update.class) ActivityParticipatorDto param)throws ProjectException{
        return activityParticipatorService.updateActivityParticipator(param);
    }

    @RequestMapping(value = "/findDetail")
    @PreAuthorize("@ss.hasPermission('ActivityParticipator:findDetail')")//权限管理;
    public ResponseRest<ActivityParticipatorVo> findDetail(@RequestBody @Validated(FindDetail.class) ActivityParticipatorDto param) throws ProjectException {
      return activityParticipatorService.findDetail(param);
    }
    /**
    * 分页查询列表
    */
    @RequestMapping(value = "/list")
    @PreAuthorize("@ss.hasPermission('activityParticipator:list')")//权限管理;
    public ResponseRest<PageInfo<ActivityParticipatorVo>> list(@RequestBody PageParam<ActivityParticipatorDto> body) throws ProjectException{
      return   activityParticipatorService.findActivityParticipatorByPageParam(body);
    }

    /**
     * 修改activityParticipator
     */
    @RequestMapping(value = "/updates",method = {RequestMethod.POST})
    @PreAuthorize("@ss.hasPermission('activityParticipator:updates')")//权限管理;
    public ResponseRest<Boolean> updates(@RequestBody @Validated(Update.class) List<ActivityParticipatorDto> params)throws ProjectException{
        return activityParticipatorService.updates(params);
    }

}
